<?php
$messageList = array();
if ($eventId > 0) {
    $event = new BWEvent($eventId);
    $messageList = $event->getMessageManager()->getMessageList();
}
Blyn::app()->getUIManager()->getCurrentScreen()->addContextVariable('eventId', $eventId); 

?>

<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3>微活动 -> 促销商品列表</h3>    
</div>

<div class="modal-body" id="Event_shop_add">
    <div><legend style="margin-bottom: 0px;">商品添加列表</legend></div>
    <fieldset>
        <table class="table table-hover">
            <thead>
                <tr>
                    <th>
                        <input type="checkbox" id="ShopCheckAll"> 
                    </th>
                    <th>商品名称</th>
    <!--                <th>数量</th>-->
                    <th>商品价格</th>
    <!--                <th>状态</th>-->
                    <th>行动</th>
                </tr> 
            </thead>
            <tbody>
                <?php
                foreach ($messageList as $id => $message) {
                    ?>
                    <tr>
                        <td><label class="checkbox">
                                <input type="checkbox" name="subBox" value="1"> 
                            </label></td>
                        <td> <?php echo $message->name; ?>  </td>
                        <td> <?php echo $message->getMediaManager()->getMedia('price')->getContent(); ?></td>
                        <td>
                            <?php
                            echo $control->getAjaxLink(array('name' => '修改', 'id' => 'modifyMessage'), array('htmlOptions' => array('enctype' => 'multipart/form-data'), 'messageId' => $id));
                            ?>
                        </td>
                    </tr>
                <?php } ?>             
            </tbody>
        </table>

        <div class="row-fluid">
            <?php echo $control->getAjaxLink(array('name' => '添加商品', 'id' => 'addMessage'), array('htmlOptions' => array('enctype' => 'multipart/form-data', 'class' => 'btn'))); ?>
            <a href="#" role="button" data-toggle="modal" class="btn">删除商品</a>
        </div>
    </fieldset>
</div> 
<div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
    <?php
    echo $control->getAjaxLink(array('name' => '下一步', 'id' => 'showMessageContent'), array('htmlOptions' => array('class' => 'btn', 'enctype' => 'multipart/form-data')));
    ?>
    <?php
   //echo $control->getAjaxLink('保存', array('htmlOptions' => array('class' => 'btn', 'enctype' => 'multipart/form-data', 'data-dismiss' => 'modal', 'aria-hidden' => 'true')));
    ?>
</div>